package cn.edu.sjtu.message_management.repository;

import cn.edu.sjtu.message_management.model.Message;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MessageRepository extends MongoRepository<Message, String> {

    List<Message> findByToUser_UserIdAndReadIsFalse(String userId);

    List<Message> findByToUser_UserIdAndReadIsTrue(String userId);

    List<Message> findByFromUser_UserId(String userId);

    Message findByMessageId(String messageId);

}
